/*******************************************************************************
*
*   FILE NAME:
*       Vector2.h - Vector2 class definition
*
*   DESCRIPTION:
*       Defines a vector with two components.
*
*******************************************************************************/
#pragma once

#include "Types.h"

class Vector2
{
public:
    static const Vector2 One;
    static const Vector2 UnitX;
    static const Vector2 UnitY;
    static const Vector2 Zero;

    float32 X;
    float32 Y;

    Vector2( void );
    Vector2( float32 value );
    Vector2( float32 x, float32 y );
    Vector2( const Vector2& other );
    ~Vector2( void );

    Vector2& operator=( const Vector2& other );
    friend boolean operator==( const Vector2& vec1, const Vector2& vec2 );
    friend boolean operator!=( const Vector2& vec1, const Vector2& vec2 );
    friend Vector2 operator+( const Vector2& vec1, const Vector2& vec2 );
    friend Vector2 operator-( const Vector2& vec1, const Vector2& vec2 );
    friend Vector2 operator*( const Vector2& vec1, const Vector2& vec2 );
    friend Vector2 operator*( const Vector2& vec, float32 scalar );
    friend Vector2 operator*( float32 scalar, const Vector2& vec );
    friend Vector2 operator/( const Vector2& vec1, const Vector2& vec2 );
    friend Vector2 operator/( const Vector2& vec, float32 divider );
    friend Vector2 operator-( const Vector2& vec );

    static Vector2 Add( const Vector2& vec1, const Vector2& vec2 );
    static Vector2 Clamp( const Vector2& vec, const Vector2& min, const Vector2& max );
    static float32 Distance( const Vector2& vec1, const Vector2& vec2 );
    static float32 DistanceSquared( const Vector2& vec1, const Vector2& vec2 );
    static Vector2 Divide( const Vector2& vec1, const Vector2& vec2 );
    static Vector2 Divide( const Vector2& vec, float32 divider );
    static float32 Dot( const Vector2& vec1, const Vector2& vec2 );
    static Vector2 Max( const Vector2& vec1, const Vector2& vec2 );
    static Vector2 Min( const Vector2& vec1, const Vector2& vec2 );
    static Vector2 Multiply( const Vector2& vec1, const Vector2& vec2 );
    static Vector2 Multiply( const Vector2& vec, float32 scalar );
    static Vector2 Negate( const Vector2& vec );
    static Vector2 Normalize( const Vector2& vec );
    static Vector2 Reflect( const Vector2& vec, const Vector2& normal );
    static Vector2 Subtract( const Vector2& vec1, const Vector2& vec2 );

    static void Add( const Vector2& vec1, const Vector2& vec2, Vector2& result );
    static void Clamp( const Vector2& vec, const Vector2& min, const Vector2& max, Vector2& result );
    static void Distance( const Vector2& vec1, const Vector2& vec2, float32& result );
    static void DistanceSquared( const Vector2& vec1, const Vector2& vec2, float32& result );
    static void Divide( const Vector2& vec1, const Vector2& vec2, Vector2& result );
    static void Divide( const Vector2& vec, float32 divider, Vector2& result );
    static void Dot( const Vector2& vec1, const Vector2& vec2, float32& result );
    static void Max( const Vector2& vec1, const Vector2& vec2, Vector2& result );
    static void Min( const Vector2& vec1, const Vector2& vec2, Vector2& result );
    static void Multiply( const Vector2& vec1, const Vector2& vec2, Vector2& result );
    static void Multiply( const Vector2& vec, float32 scalar, Vector2& result );
    static void Negate( const Vector2& vec, Vector2& result );
    static void Normalize( const Vector2& vec, Vector2& result );
    static void Reflect( const Vector2& vec, const Vector2& normal, Vector2& result );
    static void Subtract( const Vector2& vec1, const Vector2& vec2, Vector2& result );
    
    float32 Length( void ) const;
    float32 LengthSquared( void ) const;

    void Normalize( void );

protected:
private:
};
